/*
 * @Description: 
 * @Author: Binggan
 * @Date: 2019-03-19 09:09:48
 * @LastEditors: Binggan
 * @LastEditTime: 2020-03-07 20:15:42
 */
import Vue from 'vue'
import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
/* import login from '@/pages/login'
import Index from '@/pages/index'
import Department from '@/pages/department'
import UserManage from '@/pages/userManager'
import addNewPerson from '@/pages/addNewPerson'
import course from '@/pages/course'
import picModule from '@/pages/picModule'
import addPicModel from '@/pages/addPicModel'

import notice from '@/pages/notice'
import userInfo from '@/pages/personal' */

const login=resolve => require(['@/pages/login'], resolve);
const Index=resolve => require(['@/pages/index'], resolve);
const paperType=resolve => require(['@/pages/paperType'], resolve);
const newsDetail=resolve => require(['@/pages/newsDetail'], resolve);
const rubbishManage=resolve => require(['@/pages/rubbishManage'], resolve);
const rubbishType=resolve => require(['@/pages/rubbishType'], resolve);
const publicWelfare=resolve => require(['@/pages/publicWelfare'], resolve);

// const Department=resolve => require(['@/pages/department'], resolve);
const UserManage=resolve => require(['@/pages/userManager'], resolve);
// const editPaper=resolve => require(['@/pages/editPaper'], resolve);
const addPaper=resolve => require(['@/pages/addPaper'], resolve);

const userInfo=resolve => require(['@/pages/personal'], resolve);
const editPwd=resolve => require(['@/pages/editPwd'], resolve);
const dashboard=resolve => require(['@/pages/dashboard'], resolve);
const welcome=resolve => require(['@/pages/newsManage'], resolve);


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: Index,
      meta: {
        checkLogined: true
      },
      children: [
        {
          path: '',
          component: welcome,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        // {
        //   path: 'editPaper',
        //   component: editPaper,
        //   meta: {
        //     checkLogined: true,
        //     reqAuth:[0]
        //   },
        // },
        {
          path: 'paperType',
          component: paperType,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'rubbishManage',
          component: rubbishManage,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'rubbishType',
          component: rubbishType,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: '/newsDetail/:newsId',
          component: newsDetail,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: '/publicWelfare',
          component: publicWelfare,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'userManage',
          component: UserManage,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'addPaper',
          component: addPaper,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'userInfo',
          component: userInfo,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'editPwd',
          component: editPwd,
          meta: {
            checkLogined: true,
            reqAuth:[1]
          },
        },
        {
          path: 'dashboard',
          component: dashboard,
          meta: {
            checkLogined: true,
            reqAuth:[0,1,2]
          },
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {
        reqAuth:[0,1,2]
      },
    }
  ]
})
